<?php	defined ( 'ADMIN_KEKE' ) or exit ( 'Access Denied' );
kekezu::admin_check_role ( 34 );
$add_service_type = keke_glob_class::get_value_add_type ();
$payitem_record_obj = new Keke_witkey_payitem_record_class ();
$url = "index.php?do=$do&view=$view&w[record_id]=$w[record_id]&w[username]=$w[username]&w[item_code]=$w[item_code]&w[ord]=$w[ord]&page=$page&w[page_size]=$page_size";
$where = ' 1 = 1 ';
$w [record_id] and $where .= " and record_id = " . $w [record_id];
$w [username] and $where .= " and username like '%$w[username]%'";
$w [item_code] and $where .= " and item_code like '%$w[item_code]%'";
$order_where=" order by on_time desc ";
is_array($w['ord']) and $order_where = ' order by '.$w['ord'][0].' '.$w['ord'][1];
$where=$where.$order_where;
$all_buy_sql = "select sum(use_cash) as cash from " . TABLEPRE . "witkey_payitem_record ";
$all_buy_pro = db_factory::query ( $all_buy_sql );
$all_buy_pro = $all_buy_pro [0] ? $all_buy_pro [0] : 0;
$page_obj = $kekezu->_page_obj;
$page = intval ( $page );
$page or $page = 1;
$w [page_size] and $page_size = intval ( $w [page_size] ) or $page_size = 10;
$payitem_record_obj->setWhere ( $where );
$count = $payitem_record_obj->count_keke_witkey_payitem_record ();
$page_obj->setAjax(1);
$page_obj->setAjaxDom("ajax_dom");
$pages = $page_obj->getPages ( $count, $page_size, $page, $url );
$where .= $pages [where];
$payitem_record_obj->setWhere ( $where );
$payitem_record_arr = $payitem_record_obj->query_keke_witkey_payitem_record ();
require $template_obj->template(ADMIN_DIRECTORY.'/tpl/admin_payitem_' . $view );
